package com.baobao_jk.tutorialmod.items;

import com.baobao_jk.tutorialmod.Main;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.NonNullList;

public class ItemIceicon extends ItemBase {

    public ItemIceicon(){
        super("item_iceicon");
        this.setHasSubtypes(true);//设定有子类型
    }

    @Override
    public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
        for(int i = 0;i < IceSkillTypes.values().length;i++){
            subItems.add(new ItemStack(this,1,i));
        }
    }

    @Override
    public String getUnlocalizedName(ItemStack stack) {
        return super.getUnlocalizedName(stack)+ "." + IceSkillTypes.values()[stack.getMetadata()].getName();
    }

    @Override
    public void registerModels(){
        for(int i = 0;i < ItemIceicon.IceSkillTypes.values().length; i++) {
            Main.proxy.registerItemRenderer(this, i, ItemIceicon.IceSkillTypes.values()[i].getName(), "inventory"); //代理注册
        }
    }


    public static enum IceSkillTypes implements IStringSerializable {
        ICEBULLETS("icebullets",0),
        ICEFOG("icefog",1),
        ICETHORNS("icethorns",2),
        ICEBLOCK("iceblock",3),
        BLIZZARD("blizzard",4);


        private int ID;
        private String name;

        private IceSkillTypes(String nameIn,int IDIn){
            ID = IDIn;
            name = nameIn;
        }
        public String getName() {
            return name;
        }

        public int getID() {
            return ID;
        }
    }

}

